import 'package:factoryside/bean/leave_msg_entity.dart';

leaveMsgEntityFromJson(LeaveMsgEntity data, Map<String, dynamic> json) {
	if (json['StatusCode'] != null) {
		data.statusCode = json['StatusCode'] is String
				? int.tryParse(json['StatusCode'])
				: json['StatusCode'].toInt();
	}
	if (json['Info'] != null) {
		data.info = json['Info'].toString();
	}
	if (json['Count'] != null) {
		data.count = json['Count'] is String
				? int.tryParse(json['Count'])
				: json['Count'].toInt();
	}
	if (json['Data'] != null) {
		data.data = new LeaveMsgData().fromJson(json['Data']);
	}
	return data;
}

Map<String, dynamic> leaveMsgEntityToJson(LeaveMsgEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['StatusCode'] = entity.statusCode;
	data['Info'] = entity.info;
	data['Count'] = entity.count;
	if (entity.data != null) {
		data['Data'] = entity.data.toJson();
	}
	return data;
}

leaveMsgDataFromJson(LeaveMsgData data, Map<String, dynamic> json) {
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	if (json['count'] != null) {
		data.count = json['count'] is String
				? int.tryParse(json['count'])
				: json['count'].toInt();
	}
	if (json['data'] != null) {
		data.data = new List<LeaveMsgDataData>();
		(json['data'] as List).forEach((v) {
			data.data.add(new LeaveMsgDataData().fromJson(v));
		});
	}
	if (json['errcode'] != null) {
		data.errcode = json['errcode'].toString();
	}
	if (json['errorId'] != null) {
		data.errorId = json['errorId'].toString();
	}
	return data;
}

Map<String, dynamic> leaveMsgDataToJson(LeaveMsgData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['code'] = entity.code;
	data['msg'] = entity.msg;
	data['count'] = entity.count;
	if (entity.data != null) {
		data['data'] =  entity.data.map((v) => v.toJson()).toList();
	}
	data['errcode'] = entity.errcode;
	data['errorId'] = entity.errorId;
	return data;
}

leaveMsgDataDataFromJson(LeaveMsgDataData data, Map<String, dynamic> json) {
	if (json['CreateDate'] != null) {
		data.createDate = json['CreateDate'].toString();
	}
	if (json['Content'] != null) {
		data.content = json['Content'].toString();
	}
	if (json['UserName'] != null) {
		data.userName = json['UserName'].toString();
	}
	if (json['ImgUrls'] != null) {
		data.imgUrls = json['ImgUrls']?.map((v) => v.toString())?.toList()?.cast<String>();
	}
	return data;
}

Map<String, dynamic> leaveMsgDataDataToJson(LeaveMsgDataData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['CreateDate'] = entity.createDate;
	data['Content'] = entity.content;
	data['UserName'] = entity.userName;
	data['ImgUrls'] = entity.imgUrls;
	return data;
}